package IC.Symbols;

import IC.Types.*;

public class Symbol {
	private int level = 0;
	private Object symbolSemantic = null;
	private String symbolName;
	private Kind symbolKind;
	private Type symbolType;

	public Symbol(String name, Type type, Kind kind) {
		symbolName = name;
		symbolKind = kind;
		symbolType = type;
	}

	public String toString() {
		String innerInfo = "";

		if (symbolKind.PrintableTypeName())
			innerInfo += symbolType.getTypeName();

		if (symbolKind.PrintableSymbolName())
			innerInfo += " " + symbolName;

		innerInfo = innerInfo.trim();

		return (innerInfo.length() == 0) ? symbolKind.toString() : String
				.format("%s: %s", symbolKind.toString(), innerInfo.trim());
	}

	public int getLevel() {
		return level;
	}

	public void setSemantic(Object semantic) {
		symbolSemantic = semantic;
	}

	public void setSymbolLevel(int newLevel) { 
		level = newLevel;
	}

	public Object getSemantic() {
		return symbolSemantic;
	}
	
	public String getName() {
		return symbolName;
	}

	public Kind getKind() {
		return symbolKind;
	}

	public Type getType() {
		return symbolType;
	}

}
